<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="../../../js/angular1.0.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body ng-app="myApp">
		<div ng-controller="firstCntl">
			<!--<input type="text" id="" value="" ng-model="name"/>-->
			{{name}}
		</div>
		<script type="text/javascript">
			var myApp = angular.module('myApp',[]);
			myApp.provider('foo',function(){
//				var name = "dog";
				var that = this;
				this.$get = function (){
					return {						
						setName:function(name){
							if(name){
								return that.name = name;
							}else{
								return that.name
							}
						}
						
					}
				}
			})
			
			myApp.config(function(fooProvider){
				fooProvider.name = "cat";
				
				console.log(fooProvider)
			})
			
			
			var firstCntl = function($scope,foo){
				console.log(foo.setName());
			}
		</script>
	</body>
</html>
